import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { UserController } from './modules/user/user.controller';
import { UserModule } from './modules/user/user.module';
import { TypeOrmModule } from '@nestjs/typeorm';
import { ArticleModule } from './modules/article/article.module';
import { LoginModule } from './modules/login/login.module';
import { CommentModule } from './modules/comment/comment.module';
import { CollectModule } from './modules/collect/collect.module';
import { FocusModule } from './modules/focus/focus.module';
import { UploadModule } from './modules/upload/upload.module';
import { ChatgptModule } from './modules/chatgpt/chatgpt.module';
import { ServeStaticModule } from '@nestjs/serve-static';
import { join } from 'path';
@Module({
  imports: [UserModule, TypeOrmModule.forRoot({
    type: "mysql", //数据库类型
    username: "songkaiguo", //账号
    password: "Rjrx27yebPkbpaaG", //密码
    host: "111.229.148.175", //host
    port: 3306, //
    database: "songkaiguo", //库名
    dateStrings: true,
    //entities: [__dirname + '/**/*.entity{.ts,.js}'], //实体文件
    synchronize: true, //synchronize字段代表是否自动将实体类同步到数据库
    retryDelay: 500, //重试连接数据库间隔
    retryAttempts: 10,//重试连接数据库的次数
    autoLoadEntities: true, //如果为true,将自动加载实体 forFeature()方法注册的每个实体都将自动添加到配置对象的实体数组中
  }), ArticleModule, LoginModule, CommentModule, CollectModule, FocusModule, UploadModule,ChatgptModule],
  controllers: [AppController, UserController],
  providers: [AppService],
})
export class AppModule { }
